<script>
//打印
$('print').addEvent('click',function(){
    var begin_date = $('begin_date').get('value');
    var end_date = $('end_date').get('value');
    var supplier_id = $('supplier').get('value');
    var url = $('Searchform').get('action');
    url += '&p[0]=print&p[1]=' + begin_date + '&p[2]=' + end_date + '&p[3]=' + supplier_id;
    window.open(url);
});

</script>
<div class="tableform"> 
<h3>采购结算统计</h3>

<form id="Searchform" action="index.php?app=purchase&ctl=admin_statement&act=ClearingTables" method="post">
    <div class="division">
        <table width='100%' cellspacing="0" cellpadding="0" >
            <tr>
                <td>
                从：<{input type="date" name="begin_date" vtype="required" id="begin_date" value="{$clearingtable.begin_date}" }>
                至：<{input type="date" value="{$clearingtable.end_date}"  id="end_date"  name="end_date"}>
                供应商：
     <select name="supplier" id="supplier">
      <option value="">全部</option>
      <{foreach from=$supplier key=key item=val}>
      <option value="<{$val.supplier_id}>" <{if $val.supplier_id==$clearingtable.supplier_id}>selected<{/if}> ><{$val.name}></option>
      <{/foreach}>
     </select>
                <{button class="btn btn-primary" type="submit" id="saveCurrent" label="查询"}>
                </td>
            </tr>
        </table>
   </div>
</form>

<div class="division" >
统计日期范围：<{$clearingtable.begin_date}>至<{$clearingtable.end_date}>，本公司与<{if $clearingtable.supplier_name}><b><{$clearingtable.supplier_name}></b><{else}>所有供应商<{/if}>的往来帐统计如下：
</div>

<div class="division" id="accordion">
        <table width='100%' cellspacing="0" cellpadding="0" class="gridlist">
            <thead>
            <tr>
                <th>期初应付</th>
                <th>期初应收</th>
                <th>本期增加应付</th>
                <th>本期增加应收</th>
                <th>本期已付</th>
                <th>本期已收</th>
                <th>期末应付</th>
                <th>期末应收</th>
                <th>差额</th>
                <th>结算明细</th>
            </tr>
            </thead>
            <tbody>
            <tr class="toggler atStart" >
                <td><{$clearingtable.initial_pay|cur}></td>
                <td><{$clearingtable.initial_receive|cur}></td>
                <td><{$clearingtable.pay_add|cur}></td>
                <td><{$clearingtable.receive_add|cur}></td>
                <td><{$clearingtable.paid|cur}></td>
                <td><{$clearingtable.received|cur}></td>
                <td><{$clearingtable.final_pay|cur}></td>
                <td><{$clearingtable.final_receive|cur}></td>
                <td><{$clearingtable.difference|cur}></td>
                <td><a class="link" href="index.php?app=purchase&ctl=admin_statement&act=index<{if $clearingtable.supplier_id}>&p[0]=<{$clearingtable.supplier_id}>&p[1]=invoice<{/if}>">查看</a></td>
            </tr>
            </tbody>
        </table>
   </div>
   
   <div class="division">
   <{button class="btn btn-primary" type="button" id="print" label="打印"}>
   </div>
 </div>
